home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
tlx_sq15.zip
/
RING.SLT
< prev
next >
Wrap
Text File
|
1991-01-23
|
16KB
|
478 lines
// RING.SL? Do the actual calling. Returns no. of BBSes left to call,
// or -1 if fail.
//
// Thie script is called by the QDIAL script.
// Please look at the comments through the whole file, and modify to
// suit your needs, BEFORE you use it. Then recompile with CS RING.
// If you have suggestions for improving this script, please suggest
// improvements to me via old-fashioned snail-mail to:
// Inge Vabekk
// Hamangskogen 108
// N-1300 SANDVIKA
// NORWAY
//-----------------------------------------------------------
str bbs_name[32] // Name of current BBS (from operator)
,help [64] // Temporary help string.
,filelist[64]="FILELIST.BBS"// Name of BBS file list
,display []="DISPLAY"
,change []="CHANGE" // Must be set to update display.
,global []="GLOBAL"
,ssl []="SSL" // Save/restore Status Line.
,logon [14]="LOGON" // Logon script
,bbsname []="BNAME" // Global containing BBS name.
,short []="SHORT" // Global containing "short" name.
,cprot []="CPROT" // Global defining current protocol.
,prompt []="PROMPT" // Global command prompt.
,command []="Command" // Default command prompt.
,filist []="FILIST" // Name of file list for current BBS.
,read[]="R"
,write[]="W"
,DialPrfx[]="DIAL" // Dialfile prefix
,DialSufx[]=".STR" // Dialfile suffix
,DialString[14]="DIAL.STR" // Dial string file
,NextString[14]="" // Next dial string
,NumberStr [4] // Number string
,DialList [60]="" // List of dial strings.
,BBS [32] = "FAIL"
,uldir [64] // Upload mail directory.
,dlfile [12] // Download command filename.
,ulfile [64] // Upload filename.
,check [4] // Temporary.
;
int tmark // Used for timing.
,MaxNumber // Max. number of BBSes to dial.
,LastNumber // Previously dialled number
,BBSnumber // Dial string number.
,protocol // Current protocol
,voice // = 1 (TRUE) for voice calls
,f // File handle.
,busy, nocarrier, notone, voicecall // For tracking.
,stat
;
//-----------------------------------------------------------
// Script starts here.
//-----------------------------------------------------------
main()
{
int c, i, j, ll, repeat, ring;
ring = 0;
chkring(ring); // Start tracking phone ring.
_scr_chk_key = 1;
call (global,read,bbsname,bbs_name); // Get the name of the BBS.
gotoxy (0,0);
// Check the name. If not "CONT", delete old dial strings.
NextString="DIAL*.STR";
BBSnumber=0;
if (strcmpi(bbs_name,"cont")==0)
{ setchrs(DialList,0,0,60); // Clear dial list.
while (filefind(NextString,0,DialString))
{ NextString = ""; // For each string found:
for (i=0; i<4; ++i) setchr(DialString,i,' ');
i = stoi (DialString);
itos (i,NumberStr);
if (i>BBSnumber) BBSnumber = i;
i = i*2-2; // Define place in string.
setchr(DialList,i,subchr(NumberStr,0));
setchr(DialList,i+1,subchr(NumberStr,1));
}
MaxNumber = BBSnumber*2-2; // Set highest number.
}
else
{ while (filefind(NextString,0,DialString)) fdelete (DialString);
if (subchr(bbs_name,0)!='@')
find_number ();
else
{ subchrs (bbs_name,1,80,bbs_name); // Filename: Remove 1.st char.
f = fopen(bbs_name,"r");
if (f <= 0)
{ printsc (bbs_name);
prints (" not found!");
}
while (fgets(bbs_name,80,f) > 0) // Read a line.
find_number ();
fclose(f); // Close the file again.
}
}
blue();
if (BBSnumber<1)
{ prints ("No BBSes found to call.");
return (0); // No BBSes found.
}
// Dial the round of files.
//-----------------------------------------------------------
LastNumber = MaxNumber+2;
while (BBSnumber>0) // Until list is exhausted.
{ for (i=0; i<2; ++i)
{ do
{ LastNumber=LastNumber+2;
if (LastNumber>MaxNumber) LastNumber=0;
subchrs (DialList,LastNumber,2,check);
if (check !="") goto proceed;
} while (LastNumber < MaxNumber);
}
prints ("Returning from RING.");
return (0); // No more dial files.
// Go ahead, dial.
Proceed:
DialString = DialPrfx;
strcat(DialString,check);
strcat(DialString,DialSufx); // Build dial string name.
f = fopen(DialString,"r");
if (f<=0)
{ prints ("FILE OPEN ERROR! CONFLICT IN SCRIPT???! CALL AUTHOR:");
prints (" Inge Vabekk");
prints (" Hamangskogen 108");
prints (" N-1300 SANDVIKA");
prints (" NORWAY");
prints (" tel (472) 54 63 96");
setchr (DialList,LastNumber,0); // Error!
return (-1);
}
fgets (help,64,f); // Check if we have the
j=0;
for (i=0; i<25; ++i) // download file.
{ c = toupper(subchr(help,i));
if (c == 0) break;
if (c >= 'A')
{ if (isalpha(c))
{ setchr (dlfile,j,c);
if (++j>7) break; // Max. 8 characters (0-7).
}
}
}
setchr (dlfile,j,0); // Name of download file.
call (global,write,short,dlfile); // Set name into global.
j = 0;
if (!getenv ("XBOARD",uldir) // Check for XBoard.
&& (j=fopen("XBOARD.DIR","r")) < 1) // If not
{ uldir=_up_dir; // defined, build name of
strcat (uldir,dlfile); // directory for upload files,
run ("CRDIR",uldir,2); // and try to create it.
}
if (j) // XBoard definition on file:
{ fgets (uldir,64,j); // Read dir.name.
fclose (j);
}
ulfile = dlfile; // Make name of upload
strcat (dlfile,".DL"); // and download command files.
if (filesize(dlfile) < 0) // Check if command file
run ("HAVEIT$",help,0); // exists.
strcat (ulfile,".UL");
if (filesize(ulfile) < 0) // Check for existence.
{ if (filesize ("PUSH.LST") > 0) // No; if pushlist exists,
run ("DUPECHK$",help,2); // call the dupecheck program.
}
blue();
chkring(ring);
_scr_chk_key = 0;
for (ll=strlen(help); ll>0; --ll)
{ if (subchr(help,ll) > ' ') break;
setchr (help,ll,0);
}
box (17,8,51,14,2,0,36);
ll = 17 + (51-17 -ll)/2; // Center this line (name).
pstraxy ("Press 'ESC' to abort dialing.",20,10,36);
pstraxy ("Press 'D' to stop dialing", 22,11,36);
pstraxy (help, ll,12,36);
gotoxy (0,0);
fgets (help,3,f); // Read number of entries.
repeat = stoi (help); // Get repeat number.
fgets (help,80,f); // Find protocol.
protocol=subchr(help,0);
setchr (check,0,protocol); // Set protocol
setchr (check,1,0); // into global.
call (global,write,cprot,check);
fgets (logon,14,f); // Find logon script.
voice = strposi(logon,"VOICE",0)>=0; // Voice?
fgets (help,80,f); // Read dial string.
fclose (f); // Close the file.
VoiceRedial:
if (voice)
{ cputs ("+++"); // New init string.
delay(5); // This seems clumsy, but
cputs ("ATL2S7=60^M"); // cputs_tr seems to be buggy...
waitfor ("OK",1);
blue();